/***
 * * PROJECT
 * *    Logical Neighborhood Routing
 * * VERSION
 * *    $Revision: 1.3 $
 * * DATE
 * *    $Date: 2007/06/01 20:52:31 $
 * * LOG
 * *    $Log: TestSimpleEstimator.java,v $
 * *    Revision 1.3  2007/06/01 20:52:31  animesh
 * *    bulk update.
 * *
 * *    Revision 1.2  2007/01/05 09:31:46  lmottola
 * *    Modified constructor in NetworkTopology.
 * *
 * *    Revision 1.1  2007/01/04 09:22:42  lmottola
 * *    Changed getEstimation signature in Estimator interface.
 * *
 * *    Revision 1.1  2006/12/20 23:05:50  lmottola
 * *    SWANS-based simulator in.
 * *
 * *    Revision 1.1  2006/12/15 06:48:34  lmottola
 * *    First version of LNEstimator in.
 * *
 * *
 * *   Logical Neighborhoods Routing - Java Version
 * *
 * *   This program is free software; you can redistribute it and/or
 * *   modify it under the terms of the GNU General Public License
 * *   as published by the Free Software Foundation; either version 2
 * *   of the License, or (at your option) any later version.
 * *
 * *   This program is distributed in the hope that it will be useful,
 * *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 * *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * *   GNU General Public License for more details.
 * *
 * *   You should have received a copy of the GNU General Public License
 * *   along with this program; if not, you may find a copy at the FSF web
 * *   site at 'www.gnu.org' or 'www.fsf.org', or you may write to the
 * *   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * *   Boston, MA  02111-1307, USA
 ***/

package atag.runtime.ln.estimation;

import java.util.LinkedList;

import atag.common.NetworkTopology;
import atag.compiler.CommPattern;
import atag.runtime.ln.ConjunctiveScope;
import atag.runtime.ln.LNScope;
import atag.runtime.ln.predicates.LNPredicate;
import atag.runtime.ln.predicates.SetMembershipPredicate;

/**
 * @author Luca Mottola <a
 *         href="mailto:mottola@elet.polimi.it">mottola@elet.polimi.it</a>
 * 
 */
public class TestSimpleEstimator {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		// Test case
		NetworkTopology topo = new NetworkTopology();
		topo
				.readTopologyFile("/Users/luca/eclipse-workspace/ATaGscoping/atag/runtime/ln/estimation/topology.test1");
		LNSimpleEstimator estimator = new LNSimpleEstimator(topo);

		LNPredicate attachedActuator = new SetMembershipPredicate("RGSignal",
				SetMembershipPredicate.IS_IN, "attachedActuators");
		LNPredicate attachedSensor = new SetMembershipPredicate(
				"PresenceSensor", SetMembershipPredicate.IS_IN,
				"attachedSensors");
		LNScope scopeActuator = new ConjunctiveScope(
				new LNPredicate[] { attachedActuator });
		LNScope scopeSensorActuator = new ConjunctiveScope(new LNPredicate[] {
				attachedActuator, attachedSensor });

		LinkedList<CommPattern> commPatterns = new LinkedList<CommPattern>();
		commPatterns.add(new CommPattern(6, scopeActuator));
//		commPatterns.add(new CommPattern(0, scopeSensorActuator));

		double[] res = estimator.getCostEstimate(commPatterns);
		for (int i=0; i<res.length; i++) {
			System.out.println("Cost for node "+i+" is "+res[i]);
		}
	}
}
